import Vue from 'vue'
import Vuex from 'vuex'
import teacher from './teacher_store'
import parents from './parents_store'

Vue.use(Vuex)

let count = 0
try {
	if (localStorage.count) {
		count = localStorage.count
	}
} catch (e) {}


const store = new Vuex.Store({
	modules: {
		namespaced: true,
		teacher: teacher,
		parents: parents
	},
	state: {
		isTeacher: true,
		schoolId: localStorage.getItem('schoolId')
	},
	mutations: {
		setIsTeacher(state, isTeacher) {
			state.isTeacher = isTeacher
		},
		setSchoolId(state, schoolId) {
			state.schoolId = schoolId
			localStorage.setItem("schoolId", schoolId)
			console.log('setSchoolId', schoolId)
		},
	}
	
})

export default store
